<!--#INCLUDE FILE="config.asp"-->
<%
if(Session("AdminAccessLevel") <> 1 and Session("AdminAccessLevel") <> 3) then
	Response.Redirect("admin-login.asp?msg=invalid")
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../styles.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- DATE PICKER SCRIPT -->
<link type="text/css" href="../css/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.21.custom.min.js"></script>
<script>
	$(function() {
		$( "#arrival1" ).datepicker();
		$( "#departure1" ).datepicker();
		$( "#arrival2" ).datepicker();
		$( "#departure2" ).datepicker();
	});
	</script>
  <!-- END DATE PICKER SCRIPT -->

<script> 
  //$(document).ready(function(){
  //$('.dashboad_wrapper tr:nth-child(odd)').addClass('alternate');
//});
</script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
    $('#list_table tr:nth-child(2n+1)').addClass('alternate');
});
</script>

  

<title>Admin Panel de Control :: Costa Baja</title>

</head>

<body>

<div id="main_wrapper">
    	<div class="main_wrapper_margin">
        	
            <div class="admin_top_menu">
            <!--#INCLUDE FILE="admin_menu.asp"--> 
           	</div><!-- END admin_top_menu -->
             
			<h1>Panel de Control</h1>
            <div class="clear"></div>
            
            
            
            <div class="dashboad_wrapper">
              
  <table id="list_table" width="100%" border="0" cellspacing="0" cellpadding="5">
  <tr class="titles">
    <td>Pendiente</td>
    <td>Huesped</td>
    <td>Fecha</td>
    <td>Llegada/Arrival</td>
     <td>&nbsp;</td>
  </tr>
		
			
    <%
sqlstring = ""
sqlstring = sqlstring & "SELECT * FROM guestID_TravelID as v1 "
sqlstring = sqlstring & "INNER JOIN ( "
sqlstring = sqlstring & " SELECT v1.GuestID, dbo.GetFirstTravelID(v1.GuestID) AS TravelID FROM guestID_TravelID AS v1 "
sqlstring = sqlstring & " WHERE (v1.Status LIKE 'Pending Travel' ) OR (v1.Status IS NULL AND NOT EXISTS (SELECT NULL FROM guestID_TravelID AS v2 WHERE v1.GuestID = v2.GuestID AND v2.Status LIKE 'Pending Travel'))  "
sqlstring = sqlstring & " GROUP BY v1.GuestID) AS v2 ON v1.GuestID = v2.GuestID AND v1.TravelID = v2.TravelID "
sqlstring = sqlstring & " INNER JOIN ( "
sqlstring = sqlstring & " SELECT v1.GuestID, v1.TravelID, dbo.GetFirstReservationID(v1.GuestID,v1.TravelID) AS ID FROM guestID_TravelID AS v1 "
sqlstring = sqlstring & " WHERE (v1.Status LIKE 'Pending Travel') OR (v1.Status IS NULL AND NOT EXISTS (SELECT NULL FROM guestID_TravelID AS v2 WHERE v1.GuestID = v2.GuestID and v1.TravelID = v2.TravelID AND v2.Status LIKE 'Pending Travel')) "
sqlstring = sqlstring & " GROUP BY v1.GuestID, v1.TravelID) AS v3 ON v1.GuestID = v3.GuestID AND v1.TravelID = v3.TravelID AND v1.ID = v3.ID "
sqlstring = sqlstring & " WHERE v1.PendingTasksID <> 8 AND v1.PendingTasksID <> 5 AND v1.PendingTasksID <> 3 ORDER BY v1.PendingTaskDate "

set objConnect = server.createObject("ADODB.Connection")   

objConnect.Open conStr

set TblTemp = server.createobject("Adodb.Recordset")
		
		TblTemp.Open Sqlstring, objConnect
		
		Do Until TblTemp.EOF
			guestID = TblTemp("GuestId")
			letterFile = TblTemp("LetterFile")
			re_Type = TblTemp("TaskName")
			re_Surname = TblTemp("Surname")
			re_Name = TblTemp("Name")
			re_SchedDate = TblTemp("PendingTaskDate")
			re_Status = TblTemp("Status")
			re_dateArrival = TblTemp("Expr4")
			if (re_Type = "Pending Final Notification") then
				PendienteText = "<a href='send-email-confirmation.asp?letterPrefix="&Trim(letterFile)&"&gId="&guestID&"'>"&re_Type&"</a>"
			else
				PendienteText = "<a href='send-email.asp?gId="&guestID&"'>"&re_Type&"</a>"
			End if	
%>
  <tr>
    <td><strong><%=PendienteText %></strong></td>
    <td><%=re_Surname%>&nbsp; <%=re_Name%></td>
    <td><%=FormatDateTime(re_SchedDate,2)%></td>
	<% if re_dateArrival <> "" then %>
    <td><%=FormatDateTime(re_dateArrival,2)%></td>
	<%else %>
	<td></td>
	<%end if%>
	 <td><a href="admin-guest-profile-page.asp?gId=<%=guestID%>">Ver Detalles</a></td>
  </tr>
<%
	TblTemp.MoveNext
	Loop

%>
</table>
            
            </div><!-- .dashboad_wrapper -->
                        
    	</div><!-- END .main_wrapper_margin -->
        
	</div><!-- END #main_wrapper -->

         <!-- FOOTER -->
         
         <!--#INCLUDE file="admin_footer.asp"-->
         
         <!-- END FOOTER -->   

</body>
</html>
